<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
// use app\models\News;
/* @var $this yii\web\View */
/* @var $model app\models\News */

$this->title = Yii::t('app', '项目详情');
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', '项目列表'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="news-view box box-primary">
    <div class="box-header">
        <div class="btn-group">
          <a class="btn btn-primary check-status" project-id="<?=$model->id?>"><i class="icon-user icon-white"></i> <?=\Yii::t('app', '审核')?></a>
          <!-- <a class="btn btn-primary dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a> -->
          <!-- <ul class="dropdown-menu">
            <li>
                <?= Html::a('<i class="icon-trash"></i>'.Yii::t('app', '不通过'), ['update-check-status', 'id' => $model->id, 'status' => 1], [
                    // 'class' => 'btn btn-danger btn-flat',
                    'data' => [
                        // 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
                        'method' => 'post',
                    ],
                ]) ?>
            </li>
            <li>
                <?= Html::a('<i class="icon-trash"></i>'.Yii::t('app', '通过'), ['update-check-status', 'id' => $model->id, 'status' => 2], [
                    // 'class' => 'btn btn-danger btn-flat',
                    'data' => [
                        // 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
                        'method' => 'post',
                    ],
                ]) ?>
            </li>
          </ul> -->
        </div>
    </div>
    <div class="box-body table-responsive no-padding">
        <?= DetailView::widget([
            'model' => $model,
            'attributes' => [
                'id',
                'name',
                'own',
                'email:email',
                [   
                    'options' => ['width' => '110px'],
                    'attribute' => 'big_cate',
                    'format' => 'html',
                    'value'=>function($model) use ($projectCategory){
                        return $projectCategory::findOne(['id' =>$model->big_cate])->name;
                    },
                ],
                'brief_desc:html',
                'desc:html',
                [
                    'attribute'=>'logo_url',
                    'format'=>'raw',
                    'value'=>function($model){
                        return $model->getPictrues($model->logo_url);
                    }
                ],
                [  
                    'attribute'=>'status',
                    'format'=> 'html',
                    'value' => function($model){
                        return $model::getCheckStatus($model->status);
                    }
                ],
                [
                    'attribute'=>'created_time',
                    'format' => ['date', "php:Y-m-d H:i:s"],
                ],
                [
                    'attribute'=>'updated_time',
                    'format' => ['date', "php:Y-m-d H:i:s"],
                ],
                [
                    'attribute'=>'opt_note',
                    'format' => 'text',
                ]
                // 'created_time:datetime',
                // 'updated_time:datetime',
            ],
        ]) ?>
    </div>
</div>



<?php //按需注入js, 放在</body>前面
$this->registerJs("
        $(document).on('click', '.check-status', function(event) {
            var id = $(this).attr('project-id');
            var url = '/project/check?id='+id;
            layer.open({
                type: 2,
                anim: 0,
                shade: [0.3, '#393D49'],
                // skin: 'layui-layer-molv',
                title: '审核项目',
                skin: 'layui-layer-rim', //加上边框
                area: ['1200', '400px'], //自定义文本域宽高
                content: url //注意，如果str是object，那么需要字符拼接。
              });
        })
    ", 
    \yii\web\View::POS_END);
 ?>
